package cn.zktr.Personnel.common;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.WebcamResolution;

public class testWebCam {
	/**
	 * @param args
	 * @throws InterruptedException
	 */
	public static void main(String[] args) throws InterruptedException {
		JFrame window = new JFrame("Test webcam panel");
		
		Webcam webcam = Webcam.getDefault();
		
		webcam.setViewSize(WebcamResolution.VGA.getSize());
		
		WebcamPanel panel = new WebcamPanel(webcam);
		
		panel.setFPSDisplayed(true);
		
		panel.setDisplayDebugInfo(true);
		
		panel.setImageSizeDisplayed(true);
		
		panel.setMirrored(true);
		
		window.add(panel, BorderLayout.CENTER);
		
		JButton jButton = new JButton("南边");
		
		window.add(jButton, BorderLayout.SOUTH);
		jButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				
//				System.err.println(panel.get);
			}
		});
		
		window.setResizable(true);
		
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		window.pack();
		
		window.setVisible(true);
	
	}

}
